<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/>
</head>
<body>
	<div id="moduleHtml">
	 <div id="filePanelContainter">
	   <div id="fileNameContainter">
	     <div id="fileName"></div>
	   </div>
	   <div id="filePic">
	   设置有效时间：
	     <input id="dateInput">
	     <div id="button">生成伙伴口令</div>
	   </div>
	  </div>
	</div>
</body>
  <script>
  //cofit_module_js
    Cofit.moduleSourceCode.file_share=function(dom){
      var module = {
        dom : $(dom) ,        
        inited : false ,
        //显示
        show : function( file ){//file = 要展示的文件
		          var dom=$(module.dom).clone();
		          var containter=dom.find("#filePanelContainter");
		          
        	    //初始化
		          $("body").append(dom);
		          $(dom).window({    
		        	    title: "分享 [ "+file.name+" ]",    
		        	    width: 640,    
		        	    height: 200,    
		        	    closed: false ,    
		        	    cache: false ,    
		        	    modal: false ,
		        	});

		          containter.find("#fileName").html(file.name);
		          
		          $("#dateInput").datebox({
		        	  editable : false ,
		          });
	              var date = new  Date();
	              var m=date.getMonth()+1;
	              m=m>9?m:"0"+m;
	              var d=date.getDate();
	              d=d>9?d:"0"+d;
	              
	              containter.find('#dateInput').datebox({    
	                editable : false ,
	                value : date.getFullYear()+"-"+m+"-"+d ,
	              });               
	              
	              containter.find("#button").linkbutton();
	              containter.find("#button").click(function(){
	            	  $.get("./share_account/create_share_account/"+file.id,{
	            		  deadTime : containter.find('#dateInput').datebox("getValue") +" 00:00:00",
	            	  },function(resp){
	            		  $.messager.alert("伙伴口令","生成的伙伴口令为：<br/>"+resp.code+"<br/>可以在登录界面使用，请妥善保管！")
	            	  },"json");
	              });
		          module.inited=true;
        },
      };
      return module;
    };
  //cofit_module_js
  </script>
</html>